﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Soket_MMTNC_Client
{
    /// <summary>
    /// Interaction logic for Sell.xaml
    /// </summary>
    public partial class Sell : Window
    {
        public Sell()
        {
            InitializeComponent();
            Load();
        }
        Product p = new Product();
        private void Load()
        {
            p = p.GetItem(Products.id);
            txt_id.Text = p.ProductID.ToString();
            txt_name.Text = p.ProductName;            
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            p.AddBill(int.Parse(txt_id.Text),txt_quantity.Text.Trim());
            p.UpdateQuantity(int.Parse(txt_id.Text), txt_quantity.Text.Trim());
            Products.me.Load();
            this.Close();
        }
    }
}
